// 我的消息-公司信息
var company = Vue.component('company', {
    data () {
        return {
            messageData: [
                {
                    id: 0,
                    name: "A公司0",
                    type: "未读0",
                }, {
                    id: 1,
                    name: "A公司1",
                    type: "未读1",
                }, {
                    id: 2,
                    name: "A公司2",
                    type: "未读2",
                }, {
                    id: 3,
                    name: "A公司3",
                    type: "未读3",
                }
            ],
            page: {
                totalPage: 10,
                totalNum: 1,
                pageNum: 10
            }
        }
    },
    methods: {
        givePageFun: function () {
            console.log("page")
        }
    },
    // 周期
    created: function () {
        // 获取用户信息
        var self = this;
        $.ajax({
            type:"POST",
            url: _UrlPrefix + "/api/app/call/getNowUserInfo",
            data: {
                app_access: _AppAccess,
                token:'kmAvL4tmwmmC2SWrDPcCU3hHcrZY4Z7f5k8vVV328cJpFFS3ZALE75x8tgfuxPJpLAsMbExP'
            },
            success:function(res){
                if(0 == res.code) {
                    console.log("res: ", res)
                    self.messageData = res.data;
                }
            }
        })
    },
    template: ` <div class="message company">
                    <div class="message-table message-table-header">
                        <table>
                            <tr>
                                <th>消息类型</th>
                                <th>消息内容</th>
                                <th>操作</th>
                            </tr>
                            <tr v-for="value in messageData" v-key="value.id">
                                <td>{{value.name}}</td>
                                <td>{{value.type}}</td>
                                <td><a herf="#" @click="onView(value.id)">查看</a></td>
                            </tr>
                        </table>
                    </div>
                    <div class="message-table message-table-footer">
                        <common-page :getPage="page" @givePageFun="givePageFun"></common-page>
                    </div>
                </div>`
})
